#ifndef _SHARED_MASTER_H_
#define _SHARED_MASTER_H_

#include "BuildOptions.h"

#include <string>
#include <math.h>
#include <vector>
#include <map>
#include <stdexcept>
using namespace std;

// -- Versioning --
#define HIRANIPRA_VERSION 1

// -- Data Types --
typedef unsigned char uint8;
typedef signed char int8;
typedef unsigned short uint16;
typedef signed short int16;
typedef unsigned int uint32;
typedef signed int int32;
typedef unsigned long long uint64;
typedef signed long long int64;

// -- Language Helpers --
#define implements public
#define INLINE inline
#define DELETE_PTR( ptr ) if( ptr != NULL ) delete ptr; ptr = NULL;
#define FREE_PTR( ptr ) if( ptr != NULL ) free( ptr ); ptr = NULL;
#ifdef WIN32
#define FAST_CALL __fastcall
#define FORCE_INLINE __forceinline
#define EXPORT extern "C" __declspec(dllexport)
#else
#define FAST_CALL
#define FORCE_INLINE inline
#define EXPORT extern "C" 
#endif

#ifndef IGNORE
#define IGNORE              0
#endif
#ifndef INFINITE
#define INFINITE            0xFFFFFFFF
#endif

// -- Atomic Operations --
#ifdef WIN32
#define CAS( dest, comparand, exchange ) ( InterlockedCompareExchangePointer( ( volatile PVOID* )dest, ( PVOID )exchange, ( PVOID )comparand ) == comparand )
#elif defined( MACOSX )
#define CAS( dest, comparand, exchange ) OSAtomicCompareAndSwapPtr( comparand, exchange, dest )
#endif

// -- Asserts --
#define ASSERT( expr, msg )		assert( expr )
#ifdef _DEBUG
#define DASSERT( expr, msg )	assert( expr )
#else
#define DASSERT( expr, msg )
#endif

// -- Simple Types --
#include "BitMath.h"
#include "hrptr.h"
#include "HCMID.h"
#include "RefInstance.h"

#include "Event.h"
#include "EventHandler.h"
#include "EventSource.h"

// -- Threading --
#include "Threading/Thread.h"
#include "Threading/Mutex.h"
#include "Threading/FastMutex.h"
#include "Threading/Guard.h"
#include "Threading/BlockingQueue.h"
using namespace ZThread;

// -- Strings --
#include "Utilities/StringUtil.h"

#endif // _SHARED_MASTER_H_
